<%@ page language="java" %>

<%@ page import="com.scalar.chiptrack.commons.SessionKeys,
                 com.scalar.chiptrack.utils.ConfigManager,
				 com.scalar.chiptrack.commons.Constants,
				 com.scalar.chiptrack.users.Functionality,
				 com.scalar.chiptrack.users.User"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<chiptrack:checkLogon sourcePage="/shippingRequest.do" />
<%String chipTracContext = "/" + ConfigManager.getChipTracContext(); %>

<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet"></HEAD>
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/assembly_release.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/quickSearch.js"></script>

<SCRIPT language="JavaScript">
window.onload=init;

function init()
{
    qs_1 = new QuickSearch(document.shippingRequestForm['shippingRequest.processStepId'], document.shippingRequestForm.qs1, false);
}


function search()
{
    document.shippingRequestForm.action = "<%=chipTracContext%>/shippingRequest.do?action=search";
    document.shippingRequestForm.submit();
}

function reset()
{
    document.shippingRequestForm.reset();
    qs_1.resetQuickSearchCntrl();
}

function printView( shipReqId )
{
    newWindow = window.open ('<%=chipTracContext%>/shippingRequest.do?action=printerFriendly&shipReqId='+shipReqId,'printerFreindlyPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=550,resizable=yes');
}

</SCRIPT>

<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0">

<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
	<TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

	<!-- Side Navigation start -->
	<%@ include file="/jsp/operations/dataentryMenu.jsp" %></TD>
	<!-- end of the side navigations -->

	<TD bgcolor="#ffffff">
	<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
	<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
	<TD valign="top" width="100%">

	<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
	<BR>

	<html:form action="/shippingRequest.do" method="POST" onsubmit="javascript:return search();" type="com.scalar.chiptrack.operations.shippingRequest.forms.ShippingRequestForm">
        <nested:nest property="shippingRequest" >
    	<TABLE width="70%" align="center" cellpadding="2" cellspacing="2" border="0">
			<TR><TD colspan="4" class="NArialW" align="center">Ship Request</TD></TR>

			<TR><TD colspan='4' align="left" class='NArialL'>&nbsp;<FONT id="errors" color='FF0000'></font></TD></TR>
			<TR><TD colspan='4' class="NArialL"><chiptrack:errors styleClass="NArialL"/></TD></TR>
			<TR><TD colspan='4' class="NArialL"><chiptrack:info styleClass="NArialL"/></TD></TR>
			<TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
            <tr>
            <td class="NArialL" nowrap>
            Quick Search Part Number:
            </td>
            <td class="NArialL">
            <input type="text" name="qs1" class="txfield" size='18' onkeyup='quickSearch(qs_1)'/>
            </td>
            <td colspan='2'></td>
            </tr>

            <tr>
			<td class="NArialL" width="20%" nowrap>
				Part Number:
			</td>
			<td class="NArialL" width="30%">
            <nested:select property="processStepId"  styleClass="txfield">
                <html:option value="-1">All Part Numbers</html:option>
				<html:options collection="partNumberList" property="value" labelProperty="label"/>
			</nested:select>
			</td>
			<td class="NArialL" width="20%" nowrap>
				Class Store ShipTo Vendor:
			</td>
			<td class="NArialL" width="30%">
			<nested:select property="shipTolocationId"  styleClass="txfield">
                <html:option value="-1">All Class Store Vendors</html:option>
				<html:options collection="vendorList" property="value" labelProperty="label"/>
			</nested:select>
			</td>
			</tr>
            <tr>
            <td class="NArialL">
            Status:
            </td>
            <td class="NArialL">
            <nested:select property="status"  styleClass="txfield">
                <html:option value="-1">All</html:option>
                <html:options collection="statusList" property="value" labelProperty="label"/>
            </nested:select>
            </td>
            <td class="NArialL">
			Year:
			</td>
			<td class="NArialL">
			<nested:select property="year"  styleClass="txfield">
				<html:option value="-1">All</html:option>
				<html:options collection="yearList" property="value" labelProperty="label"/>
			</nested:select>
			</td>
                <TD COLSPAN='2'/>
            </tr>

			<TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
			<tr>
				<td colspan="5" align="center">
                 <input type=image border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" onclick="javascript:search()" width="53" height="17" onmouseover="window.status='Click to Search for Class Store Lots';return true" onmouseout="window.status='';return true" title="Click here to Search for Class Store lots">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="javascript:reset()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
				</td>
			</tr>
            <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
            <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
            <tr><td colspan='4' class="NArialL">
            Please <chiptrack:restrictedLink functionality='<%=Functionality.DATA_ENTRY %>' action='<%=User.USER_ACTION_MODIFY%>' styleClass="leftsection" href='<%=chipTracContext+"/shippingRequest.do?action=new"%>'
                                onmouseover="window.status='Click to Create Ship Request';return true" onmouseout="window.status='';return true">click here</chiptrack:restrictedLink> to generate new Ship Request</tr></td>
            <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>

            <logic:present name="searchList" scope="request">
            <TR>
                <TD colspan='4'>
                    <table width="100%" align="left" cellpadding="2" cellspacing="2" border="0">
                        <tr>
                            <td width="15%" class="NArialL" bgcolor="#993333" nowrap align="center">
                                <font color="#FFFFFF">Ship Req No</font>
                            </td>
                            <td width="15%" class="NArialL" bgcolor="#993333" nowrap align="center">
                                <font color="#FFFFFF">Part Number</font>
                            </td>
                            <%--<td width="15%" class="NArialL" bgcolor="#993333" nowrap align="center">
                                <font color="#FFFFFF">From Vendor</font>
                            </td>--%>
                            <td width="15%" class="NArialL" bgcolor="#993333" nowrap align="center">
                                <font color="#FFFFFF">To Vendor</font>
                            </td>
                            <td width="15%" class="NArialL" bgcolor="#993333" align="center">
                                <font color="#FFFFFF">Status</font>
                            </td>
                            <td width="25%" class="NArialL" bgcolor="#993333" nowrap align="center">
                               <font color="#FFFFFF"> Actions</font>
                            </td>
                        </tr>
                        <logic:iterate name="searchList" id="shippingRequest"  indexId="iteratorIdx" >
                            <tr <%if(iteratorIdx.intValue()%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>>

                                <td width="20%" class="NArialL">
                                    <bean:write name="shippingRequest" property="shipReqNumber" />
                                </td>

                                <td width="15%" class="NArialL" nowrap>
                                   <bean:write name="shippingRequest" property="partNumber" />
                                </td>
                                <%--<td width="15%" class="NArialL" nowrap>
                                    <bean:write name="shippingRequest" property="fromVendorName" />
                                </td>--%>
                                <td width="15%" class="NArialL" nowrap>
                                    <bean:write name="shippingRequest" property="toVendorName" />
                                </td>

                                 <td width="15%" align='right' class="NArialL">
                                    <bean:write name="shippingRequest" property="status" />
                                </td>

                               <%-- <html:hidden name='shippingRequest' property="processStepId" />--%>
                                <html:hidden name='shippingRequest' property="lotId" />
                                <td class="NArialL" align="center" NOWRAP>

                                    <logic:notEqual name="shippingRequest" property="status" value='Cancelled'>
                                        <logic:notEqual name="shippingRequest" property="status" value='Closed'>
                                            <a href='<%=chipTracContext%>/shippingRequest.do?action=view&shipReqId=<bean:write name="shippingRequest" property="shipRequestId" />' onMouseOver="window.status='Click to View Shipping Request';return true" onMouseout="window.status='';return ">View</a>&nbsp;&nbsp;&nbsp;&nbsp;

                                            <a href='<%=chipTracContext%>/shippingRequest.do?action=modify&shipReqId=<bean:write name="shippingRequest" property="shipRequestId" />' onMouseOver="window.status='Click to Modify Shipping Request';return true" onMouseout="window.status='';return ">Modify</a>&nbsp;&nbsp;&nbsp;

                                            <logic:notEqual name="shippingRequest" property="status" value='Approved'>
                                                <a href='<%=chipTracContext%>/shippingRequest.do?action=approved&shipReqId=<bean:write name="shippingRequest" property="shipRequestId" />' onMouseOver="window.status='Click to Approve Shipping Request';return true" onMouseout="window.status='';return ">Approve</a>&nbsp;&nbsp;&nbsp;
                                            </logic:notEqual>

                                            <logic:equal name="shippingRequest" property="status" value='Approved'>
                                                Approve&nbsp;&nbsp;&nbsp;
                                            </logic:equal>
                                            <a href='<%=chipTracContext%>/shippingRequest.do?action=cancel&shipReqId=<bean:write name="shippingRequest" property="shipRequestId" />' onMouseOver="window.status='Click to cancel this Shipping Request';return true" onMouseout="window.status='';return ">Cancel</a>&nbsp;&nbsp;&nbsp;
                                            <a href='<%=chipTracContext%>/shippingRequest.do?action=close&shipReqId=<bean:write name="shippingRequest" property="shipRequestId" />' onMouseOver="window.status='Click to Close this Shipping Request';return true" onMouseout="window.status='';return ">Close</a>&nbsp;&nbsp;&nbsp;
                                       </logic:notEqual>

                                    </logic:notEqual>

                                    <logic:equal name="shippingRequest" property="status" value='Cancelled'>
	                                    <a href='<%=chipTracContext%>/shippingRequest.do?action=view&shipReqId=<bean:write name="shippingRequest" property="shipRequestId" />' onMouseOver="window.status='Click to View Shipping Request';return true" onMouseout="window.status='';return ">View</a>&nbsp;&nbsp;&nbsp;&nbsp;
                                        Modify&nbsp;&nbsp;&nbsp;Approve&nbsp;&nbsp;&nbsp;Cancel&nbsp;&nbsp;&nbsp;Close&nbsp;&nbsp;&nbsp;
                                    </logic:equal>
                                    <logic:equal name="shippingRequest" property="status" value='Closed'>
	                                    <a href='<%=chipTracContext%>/shippingRequest.do?action=view&shipReqId=<bean:write name="shippingRequest" property="shipRequestId" />' onMouseOver="window.status='Click to View Shipping Request';return true" onMouseout="window.status='';return ">View</a>&nbsp;&nbsp;&nbsp;&nbsp;
                                        Modify&nbsp;&nbsp;&nbsp;Approve&nbsp;&nbsp;&nbsp;Cancel&nbsp;&nbsp;&nbsp;Close&nbsp;&nbsp;&nbsp;
                                    </logic:equal>

                                </td>
                            </tr>
                        </logic:iterate>
                    </table>
                </TD>
           </TR>
           </logic:present>
		</TABLE>
    </nested:nest>
	</html:form>
<!-- till here -->
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>

<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->

</BODY>
</HTML>
